package com.example.myprojectoffeixue;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.HashMap;
/**
 * Created by ASUS on 2017/2/15.
 */
public class adapter_house extends BaseAdapter {
    private Context context;
    private LayoutInflater layoutInflater;
    public ArrayList<HouseUtil> kt_flag;
    public adapter_house( Context context, ArrayList<HouseUtil> kt_flag) {
        super();
        this.kt_flag=kt_flag;
        this.context = context;
        this.layoutInflater = LayoutInflater.from(context);
    }
    @Override
    public int getCount() {
        return kt_flag.size();
    }
    @Override
    public Object getItem(int position) {
        return kt_flag.get(position);
    }
    @Override
    public long getItemId(int position) {
        return position;
    }
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        ViewHolder h = null;
        if (convertView == null) {
            h = new ViewHolder();
            convertView = layoutInflater.inflate(R.layout.item_cj, null);
            h.name= (TextView) convertView.findViewById(R.id.tv_cjitem);
            h.iv= (ImageView) convertView.findViewById(R.id.iv_cjitem);
            convertView.setTag(h);
        } else {
            h = (ViewHolder) convertView.getTag();
        }
        h.name.setText(kt_flag.get(position).name);
        h.iv.setImageResource(R.drawable.fj);
        return convertView;
    }
    class ViewHolder {
        TextView name;
        ImageView iv;
    }

}